import { defineStore } from "pinia";
import piniaPersistConfig from "@/stores/helper/persist";

// 测试pinia的持久化存储
export const useTestStore = defineStore({
  id: "host-test",
  state: () => ({
    test: { a: "测试pinia的持久化存储" },
    test2: { a: "测试pinia的持久化存储" },
  }),
  getters: {
    testGet: (state) => state.test,
  },
  actions: {
    async setTest(t) {
      this.test = t;
    },
  },
  // 只对 test 持久化存储
  persist: piniaPersistConfig("host-test", ["test"]),
});
